package cn.kgc.tangcco.redirect;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/10/19 上午11:05
 */
@WebServlet(urlPatterns = "/redirect01")
public class Redirect01 extends HttpServlet {
    private static final long serialVersionUID = 7903305690335123309L;

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("redirect01");
        request.setAttribute("slogan","桃李不言下自成蹊");
        String slogan = request.getParameter("slogan");
        System.out.println("redirect01接slogan>>>" +  slogan);
        response.setHeader("slogan","桃李不言下自成蹊");
        response.sendRedirect(request.getContextPath() + "/redirect02?slogan=" + slogan);
    }
}
